{extend name="base" /} {block name="seo"}
{/block}
{block name="css"}
<link href="__HOME__/css/user.css" rel="stylesheet" type="text/css">
{/block}
{block name="body"}
<div class="container">
    <div class="user">
        {include file="index/menu"}


        <div class="user-info user-box fl" style="position: relative;">
            <div class="title">
                数据概述
                <span>累计投稿 <b id="count">{$total.count}</b> 篇。</span>
            </div>
            <ul class="data-ul  layui-clear">
                <li>
                    <font class="layui-icon layui-icon-ok-circle" style="background:#38ad23;"></font>
                    <div>
                        <b>{$total.passed_num}</b>
                        <span>通过</span>
                    </div>
                </li>
                <li>
                    <font class="layui-icon layui-icon-list" style="background:#62a1ff;"></font>
                    <div>
                        <b>{$total.wait_check}</b>
                        <span>待审核</span>
                    </div>
                </li>

                <li>
                    <font class="layui-icon layui-icon-face-cry" style="background:#fd644c;"></font>
                    <div>
                        <b>{$total.faild_num}</b>
                        <span>被拒绝</span>
                    </div>
                </li>
            </ul>
            <div class="title" style="margin-top: 20px">
                投稿记录
            </div>
            <div class="tg-list">

                <ul id="page_body_id" style="min-height: 480px">
                </ul>
                <p id="page_id" style="text-align: center"></p>
            </div>



        </div>
    </div>

    {/block}
    {block name="script"}
    <!-- 单个详情 -->
    <script id="introduce" type="text/html">
        <div class="intr">
            <div class="layui-clear">
                <div class="left"> 标题：</div>
                <div class="right"> {{d.title}}</div>
            </div>
            <div class="layui-clear">
                <div class="left"> 投稿时间：</div>
                <div class="right"> {{d.create_time}}</div>
            </div>
            <div class="layui-clear">
                <div class="left"> 投稿状态：</div>
                <div class="right"> {{#if(d.status==1){}} 已通过 {{#}else if(d.status==2){}} 不通过 {{#}else{}} 待审核 {{#}}}</div>
            </div>

            <div class="layui-clear">
                <div class="left"> 审核时间：</div>
                <div class="right"> {{#if(d.publish_time){}} {{d.publish_time}} {{#}else if(d.check_time){}} {{d.check_time}} {{#}}}</div>
            </div>
            <div class="layui-clear">
                <div class="left"> 审核结果：</div>
                <div class="right"> {{d.check_result}}</div>
            </div>
            <div class="layui-clear">
                <div class="left"> 奖励金额：</div>
                <div class="right"> {{d.reward_amount}}</div>
            </div>
            <div class="layui-clear">
                <div class="left"> 奖励备注：</div>
                <div class="right"> {{d.reward_result}}</div>
            </div>
        </div>
    </script>
    <script id="page_template_id" type= "text/html">
        {{# layui.each(d.list, function(index, item){ }}
        <li class="layui-clear">
            {{# var a ;if(item.status===1){}}
            {{# a = ' href="' + item.link + '" target="_blank"'}}
            {{#}else{}}
            {{# a = ' href="javaScript:msg();"'}}
            {{#}}}
            <div class="list-img">
                <img src="{{item.cover_img}}" onerror="this.src='__STATIC__/common/images/no-img.png';">
             </div> <div class="list-info">
            <h3 class="list-title">
                {{#if(item.status==1){}} <i class="success"> 通过 </i> {{#}else if(item.status==2){}} <i class="bad"> 不通过 </i> {{#}else{}} <i> 待审核 </i> {{#}}}

            <a title="可点击" {{ a }}>{{item.title}}</a> </h3>

            <div class="list-content"> {{item.description}} </div>
            <div class="btn layui-clear"> <div class="left">投稿时间：{{item.create_time}} </div>
                <a class="right" data-id="{{item.id}}"  href="JavaScript:;">查看详情</a>
                 </div>
        </div>
        </li>
        {{# }); }}
    </script>
    <script>
        function msg() {
            layer.msg("待审核或不通过的教程 是无法查看的哦！");
        }
        $('body').on('click', '.favorite-del', function () {
            var $this=$(this);
            request({
                url: config.api.user_common_del,data:{subject:'article',id:$this.data('id')}
            });
        })

        renderPageData( '/api/user/subjects',"page_id", "page_template_id" ,
            "#page_body_id" ,'count',{subject:'article'});


        $(".tg-list").on("click", ".btn .right", function () {
            //弹出投稿详情
            var _id = $(this).data("id");
            request({
                url: '/api/user/record_detail/id/' + _id + '.html',
                // data: {"id": _id},
                success: function (res) {
                    result = res.data;
                    if (result) {
                        laytpl($("#introduce").html()).render(result.data, function (html) {

                            layer.open({
                                type: 0,
                                shadeClose: true,
                                skin: 'atuikeLayerSkin1 trlayer',
                                content: html,
                                btn: ['我知道了'],
                                area: ['320px', '350px']
                            });
                        });
                    }
                }
            });
        });
    </script>
    {/block}
